﻿using System;
using System.Globalization;

namespace DataModel.Managers.SubManage
{
    public static class ExtensionDate
    {
        /// <summary>
        /// Compare date only by year, month and day
        /// </summary>
        /// <param name="main"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public static bool CompareOnlyDate(this DateTime main, DateTime date)
        {
            bool compareResult = true;
            if (main.Year != date.Year)
            {
                compareResult = false;
            }
            else 
            {
                if (main.Month != date.Month)
                {
                    compareResult = false;
                }
                else
                {
                    if (main.Day != date.Day)
                    {
                        compareResult = false;
                    }
                }
            }
            return compareResult;
        }
    }
}
